import api from "../utils/request.js"
const adminApi = {
    PostMessage: (formDat) => {
        return api.post('userDetail/data', formDat)
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            });
    },
    getAllData: (params) => {
        return api.get('userDetail/search', {params: params})
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            });
    },
    deleteById: (id) => {
        return api.delete(`userDetail/${id}`)
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            });
    },
    getBYId: (id) => {
        return api.get(`userDetail/${id}`)
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            })
    },
    updateBYId: (formDate) => {
        return api.put('userDetail/detailData', formDate)
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            });
    },
    searchData: (formData) => {
        return api.get('userDetail/search', {params: formData})
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            });
    },
    deleteBYids: (ids) => {
        return api.post('userDetail/DeleteByIds', ids)
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            })
    },
    postProduct: (product) => {
        return api.post('product/post', product)
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            });
    },
    getAllProductData: (params) => {
        return api.get('product/search', {params: params})
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            });
    },
    deleteProductById: (id) => {
        return api.delete(`product/${id}`)
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            });
    },
    deleteProBYids: (ids) => {
        return api.post('product/DeleteByIds', ids)
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            })
    },
    getProBYId: (id) => {
        return api.get(`product/${id}`)
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            })
    },
    putProData: (product) => {
        return api.put('product/putData', product)
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            })
    },
    CheckExistProduct: (Product) => {
        return api.request({
            method: 'post',
            url: 'product/CheckExistProduct',
            data: Product
        })
    },
    //下面这些就是关于那个反馈信息的了
    getAllFeedback: (params) => {
        return api.get('feedback/search', {params: params})
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            });
    },
    DeleteFeedBackBYId: (id) => {
        return api.delete(`feedback/${id}`)
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            })
    },
    UpdateProductById:(params) => {
        return api.put('feedback/Change', params)
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            });
    },
    getAllFeedBackData:()=>{
        return api.get('feedback/FeedBackData')
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            })
    },
    getBirthdayData:()=>{
        return api.get('userDetail/BirthdayData')
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            })
    },
    getPaymentData:()=>{
        return api.get('alipay/PaymentData')
            .then(response => response.data)
            .catch(error => {
                console.log(error);
                return null;
            })
    }
}
export default adminApi
